﻿using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using static SimpleWebApi.MyMigration.Models.BusinessLicenseManagement.LegalPerson;

namespace SimpleWebApi.Business.Service.Interface.DTO.BusinessLicenseDTO
{
    public class LegalPersonCreateDto
    {
                
        [Required]
        [StringLength(50)]
        public string Name { get; set; } // 姓名

        
        public string? Ethnicity { get; set; } // 民族
                
        [Required]
        [StringLength(18, MinimumLength = 18)]
        public string IdNumber { get; set; } // 身份证号
                  
        [StringLength(255)]
        public string? Address { get; set; } // 地址

        [Required]
        [StringLength(20)]
        public string Phone { get; set; } // 联系电话
                
        [StringLength(50)]
        public string? WeChat { get; set; } // 微信

        
        public EducationLevel Education { get; set; } = EducationLevel.不详;// 学历
    }

    // LegalPersonDto.cs（用于选择已有法人）
    
    public class LegalPersonDto
    {
        public int Id { get; set; }
        public string Name { get; set; }
        [Required(ErrorMessage = "身份证号必填")]
        [StringLength(18, MinimumLength = 18, ErrorMessage = "身份证号必须为18位")]
        [RegularExpression(@"^\d{17}[\dXx]$", ErrorMessage = "身份证号格式无效")]
        public string IdNumber { get; set; }
    }


    public class LegalPersonOperationDto
    {
        // 操作类型：Link（仅关联）、Update（更新后关联）、Create（新建）
        [Required]
        public string Action { get; set; }

        // Link/Update 时必填
        public int? Id { get; set; }

        // Update/Create 时必填
        public LegalPersonCreateDto? Data { get; set; }
    }
}
